<?php

namespace App\Trip\Enums\Plane;

use App\Trip\Plane\Factories\PlaneOrderFactory;
use App\Trip\Plane\Factories\PlaneQueryFactory;
use App\Trip\Plane\Interfaces\PlaneOrderInterface;
use App\Trip\Plane\Interfaces\PlaneQueryInterface;

enum PlaneProviders: string
{
    // 供应商 book51
    case BOOK51 = 'book51';
    // 供应商 去哪儿
    case QUNAR = 'qunar';

    public function getPlaneQueryStrategy(): PlaneQueryInterface
    {
        $factory = new PlaneQueryFactory();
        return match ($this) {
            self::QUNAR  => $factory->QunarQuery(),
            self::BOOK51 => $factory->Book51Query(),
        };
    }

    public function getPlaneOrderStrategy(): PlaneOrderInterface
    {
        $factory = new PlaneOrderFactory();
        return match ($this) {
            self::QUNAR  => $factory->QunarOrder(),
            self::BOOK51 => $factory->Book51Order(),
        };
    }

}